<?php
	require_once($_SERVER["DOCUMENT_ROOT"]."/global.php");
	require_once($_SERVER["DOCUMENT_ROOT"]."/modules/security_mod.php");
	require_once($_SERVER["DOCUMENT_ROOT"]."/alerter/modules/watched_mod.php");

	SecurityMod::login();

	$level = $_SESSION["account"]->getLevel();
	if ($level != "Admin" && $level != "AlertUser")
		SecurityMod::logout();

	$id = v($_REQUEST, "id");
	$pid = v($_REQUEST, "pilot_id");
	$pilot = v($_REQUEST, "pilot");
	$faction = v($_REQUEST, "faction");
	$alliance = v($_REQUEST, "alliance");
	$alerter = v($_REQUEST, "alerter");
	
	WatchedMod::updateWatched(
		new Watched(
			$id,
			$pid,
			$pilot,
			$faction,
			$alliance,
			$alerter)
	);

	header('location: watch_list.php');
?>